package com.example.koki.util;

import java.sql.Connection;
import java.sql.DriverManager;

public class HelloServlet {
    private String FileName;
    private int DBType;
    private Connection conn;
    private String MySqlDriver;
    private String MySqlUrl;
    private Connection coon;

    public DBConnection() {
        conn = null;
    }
    public Connection getConn() {

        DBType=1;

        switch (DBType){
            case 1:
                return (getCoonToMySql());
            default:
                return null;
        }
    }
    public Connection getCoonToMySql() {
        try{
            MySqlDriver="com.mysql.cj.jdbc.Driver";
            MySqlUrl="jdbc:mysql://localhost:3306/sky7";
            String s = "?user=root&password=mysql&useUnicode=true";
            String s1 = "&characterEncoding=utf8";
            Class.forName(MySqlDriver);
            coon = DriverManager.getConnection(MySqlUrl);
        } catch (Exception e){
            e.printStackTrace();
        }
        return conn;
    }
}
